package cn.edu.demo.service;

import cn.edu.demo.mapper.DriverMapper;
import cn.edu.demo.pojo.Driver;
import cn.edu.demo.pojo.DriverExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class DriverServiceImpl implements DriverService{

    @Autowired
    DriverMapper driverMapper;

    @Override
    public Driver getDriver(String d_id) {
        DriverExample example = new DriverExample();
        DriverExample.Criteria criteria = example.or();
        criteria.andDriverIdEqualTo(d_id);
        return driverMapper.selectByExample(example).size()!=0?driverMapper.selectByExample(example).get(0):null;
    }

    @Override
    public Driver getNearDriver(byte[] coordinate) {
        return null;
    }
}
